﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebCalendar.Filters;
using WebMatrix.WebData;

namespace WebCalendar.Models.Authorization
{
    [InitializeSimpleMembership]
    public static class WebCalendarUser
    {
        public static string UserName
        {
            get
            {
                return WebSecurity.CurrentUserName;
            }
        }
        public static int UserId
        {
            get
            {
                return WebSecurity.CurrentUserId;
            }
        }
        public static UserProfile GetUserProfile(WebCalendarContext context)
        {
            var user = context.UserProfiles.Include("CalendarRoles").Include("CalendarRoles.Calendar").Include("Categories").FirstOrDefault(m => m.UserId == WebSecurity.CurrentUserId);
            
            return user;
        }

    }
}